package day4;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

/**
 * @author oldliu
 * @since 1.0
 */
public class Set2 {
    public static void main(String[] args) {
        Set list=new HashSet();
        list.add(new BankAcc("hf--1","老吴","123","shanghai",1000000.0F));
        list.add(new BankAcc("hf--2","小刘","1243","shanghai",100030.0F));
        list.add(new BankAcc("hf--3","小李","1523","nanjing",60000.0F));
        list.add(new BankAcc("hf--4","老张","623","shanghai",1000.0F));
        list.add(new BankAcc("hf--3","小马","282938282", "安庆",7676666.0F));
        System.out.println("个数:"+list.size());
        for(Object o:list){
            BankAcc ac=(BankAcc)o;
            System.out.println(ac.getNo()+","+ac.getName()+","+ac.getMoney());
        }
        System.out.println(">>>>>迭代器一次");
        Iterator ir = list.iterator();
        while (ir.hasNext()){
            System.out.println(ir.next());
        }
        System.out.println("结束了，再来一次：");
        while (ir.hasNext()){
            System.out.println(ir.next());
        }
    }
}
